#ifndef _FIG_UI_POPUPANIMATOR_H_
#define _FIG_UI_POPUPANIMATOR_H_

#include "fig_mogaui.h"

#include "util/delegate.h"
#include "ui/ui_widget.h"


namespace gameflow
{
	class UIPopup;
}

class FIGUIPopupAnimator : public FIGMOGANavigation
	//public MATAnimatedFinishCallBack
{
public:

	enum	ANIMATION_TYPE
	{
		ANIMATION_MSGPOPUP,
		ANIMATION_SLIDEFROMRIGHT,
		ANIMATION_SLIDEFROMTOP,

		ANIMATION_C,
	};

	
	
	FIGUIPopupAnimator(const std::string& Name,const std::string& CloseButton);
	FIGUIPopupAnimator(gameflow::UIPopup* pPopup);
	FIGUIPopupAnimator();
	
	virtual	void					Tick(float dt);  	
	virtual void					Show();
	virtual void					Hide();
	virtual void					OnAnimatedUIFinish(){};
	
	virtual void					OnMouseButtonDown(const math::Vec2& Pos){};
	virtual bool					KeyPressed(input::Keyboard::KEY* pKey){ return false; };
	gameflow::UIPopup*				GetPopup() { return m_pPopup; };
	bool							OnUIKeyDownEvent(int KeyCode); 
	void							SetCloseButton(const std::string& CloseButton);

protected:

	ui::UIWidget*					m_pCloseButton;   
	gameflow::UIPopup*				m_pPopup;
	ui::UIWidget*					m_pAnimateWidget;
	ANIMATION_TYPE					m_Type;

};

class FIGUIPopupAnimatorMgr 
{
public:

	enum	POPUP_NAMES
	{
		POPUP_NAMES_SETTING,
		POPUP_NAMES_PAUSEMENU,
		POPUP_NAMES_MSGBOX,
		POPUP_NAMES_GAMEOVER,		
		POPUP_NAMES_YESNO,	
		POPUP_NAMES_CONTROLLER,
		POPUP_NAMES_MEDALINFO,
		//POPUP_NAMES_ACHIEVEMENT,
		//POPUP_NAMES_ACHIEVEMENTGAIN,

		POPUP_NAMES_C,
	};

	
	static FIGUIPopupAnimatorMgr&				Instance();
    void										Tick(float dt);
	FIGUIPopupAnimator*							Show(POPUP_NAMES Name);
	FIGUIPopupAnimator*							GetPopup(POPUP_NAMES Name);
	void										AddPopupAnimator(POPUP_NAMES Name,FIGUIPopupAnimator* pPopupAnimator );
	void										OnMouseButtonDown(const math::Vec2& Pos);
	bool										KeyPressed(input::Keyboard::KEY* pKey);
	bool										OnUIKeyDownEvent(int KeyCode);

protected:

	FIGUIPopupAnimatorMgr();
	~FIGUIPopupAnimatorMgr();

	FIGUIPopupAnimator*							m_pPopups[POPUP_NAMES_C];
	

};


#endif //_PVI_UI_WRAPPER_H_